package ipad.asia.service.impl;

import ipad.asia.dao.ExpressDao;
import ipad.asia.entity.Express;
import ipad.asia.service.ExpressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Service
public class ExpressServiceImpl implements ExpressService {
    @Autowired
    private ExpressDao expressDao;

    @Override
    public List<Express> findByShopId(int shopId) {
        return expressDao.findByShopId(shopId);
    }

    @Override
    public List<Express> findByConsumerId(int consumerId) {
        return expressDao.findByConsumerId(consumerId);
    }

    @Override
    public void expressAdd(int orderId, int consumerId, int shopId, String expressName, String expressNumber,
                           String departAddress, String destAddress, Date date, int statues) {
        Express express=new Express();
        express.setOrderId(orderId).setConsumerId(consumerId).setShopId(shopId).setExpressName(expressName)
                .setExpressNumber(expressNumber).setDepartAddress(departAddress).setDestAddress(destAddress).setDate(date).setStatues(statues);
        expressDao.save(express);
    }

//    @Override
//    public void updateExpress(int id,String expressName, String expressNumber, String departAddress, String destAddress, LocalDateTime date) {
//        Express express=new Express();
//        express.setId(id).setExpressName(expressName)
//                .setExpressNumber(expressNumber).setDepartAddress(departAddress).setDestAddress(destAddress).setDate(date);
//        expressDao.save(express);
//    }



}
